﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include <GbmpDefines.h>
#include <map>
#include <string>
#include "GmepCommonData.h"
#include "DataSchemaPrivate.h"
#include "GmepBuiltInParameterStaticVauleListItems.h"
#include "GbmpTypeDefs.h"

namespace gmep
{
    /// \brief 专业分类
     enum class MEPDisciplineId : Int32
    {
        Undefined = 0,

        HVAC = 1,                   ///< 暖通
        WaterSupplyAndDrainage = 2, ///< 给排水
        Electrical = 3,              ///< 电气
        Other = 4                     ///< 其他规则
    };

    /// \brief 连接方式
    enum class MEPConnectorType : Int32
    {
        Undefined = 0,

        PipeSeamlessConnector = 1,  ///< 无缝焊接
        PipeFlangeConnector = 2,    ///< 法兰对接
        PipeChengdaConnector = 3,   ///< 承接对接
        PipeScrewedConnector = 4,  ///< 螺纹（丝扣）对接
        PipeCollarConnector = 5,   ///< 卡箍对接
        PipeMeltconnection = 6,  ///< 粘熔连接

        DuctConnector = 11,

        TrayStellConnector = 21,    ///< 桥架接管体系
        TrayFabricatedBusConnector = 22,

        ConduitConnector = 31       ///< 线管接管体系
    };

    enum class GmepProjectSettingMEPObjectType : Int32
    {
        Undefined = 0,

        Pipe = 1,
        Duct = 2,
        CableTray = 3,
        Conduit = 4,
        Cable = 5,
        ConduitOrCable = 6, // for system type
        ProvisionOpening = 7 //预留孔洞
    };

    /// \brief Cable tray section align
    /// 
    /// Top-Left ****** Top-Center ****** Top-Right
    ///    *               *                 *
    ///    *               *                 *
    ///    *               *                 *
    /// Middle-Left *** Center ********** Middle-Right
    ///    *               *                 *
    ///    *               *                 *
    ///    *               *                 *
    /// Bottom-Left *** Bottom-Center *** Bottom-Right
    enum class SectionAlignment :Int32
    {
        Center = 0,
        TopLeft = 1,
        TopCenter = 2,
        TopRight = 3,
        MiddleLeft = 4,
        MiddleRight = 5,
        BottomLeft = 6,
        BottomCenter = 7,
        BottomRight = 8
    };
    /// \brief 电缆桥架几何形状类型
    SERIALIZABLE_ENUM_CLASS(CableTrayShape)
    {
        Invalid = -1,            ///< 无效类型
        Channel = 0,             ///< 槽型电缆桥架
        Ladder = 1               ///< 梯型电缆桥架
    };

    enum class PreferredJunctionType : Int32
    {
        TeeJunction = 0,         ///< 三通(分割主管)接头类型
        TapJunction = 1,         ///< 三通(不分割主管)接头类型
    };

    enum class MEPSystemClassificationType : Int32
    {
        Pipe = 1,
        WireAndConduit = 2,
        //桥架系统类型暂时改为不限，后续会删除
        //wuxy-j 2020.09.24
        Global = 3,              ///< 不限     
        Duct = 4
    };


    /// \brief 系统分类
    enum class MEPSystemClassification :Int32
    {
        UndefinedSystemClassification = -1,///< 未定义

        ///暖通
        SupplyAir = 1,                     ///< 送风
        ReturnAir = 2,                     ///< 回风
        FreshAir = 3,                      ///< 新风
        ExhaustAir = 4,                    ///< 排风
        OtherAir = 9,                      ///< 其它

        GlobalAir = 10,                    ///< 不限

        SupplyHydronic = 11,               ///< 循环供水
        ReturnHydronic = 12,               ///< 循环回水
        RefrigerantPipe = 13,              ///< 冷媒管
        CondenserPipe = 14,                ///< 冷凝水

        ///给排水
        WaterSupply = 21,                  ///< 给水
        SupplyHotWater = 22,               ///< 热给水
        ReturnHotWater = 23,               ///< 热回水
        Drainage = 24,                     ///< 排水
        Vent = 25,                         ///< 通气
        FireHyrant = 26,                   ///< 消火栓
        FireProtectSprinkler = 27,         ///< 自动喷水
        FireProtectDry = 28,               ///< 干式消防
        FireProtectGas = 29,               ///< 气体灭火
        OtherPipe = 39,                    ///< 其它

        GlobalWater = 40,                  ///< 不限

        ///电气
        Lighting = 41,                     ///< 照明
        PowerSupplyAndDistribution = 42,   ///< 供配电
        LightningProtectionGrounding = 43, ///< 防雷接地
        WeakCurrent = 51,                  ///< 弱电
        FireAlarm = 52,                    ///< 火灾自动报警 
        OtherElectrical = 59,              ///< 其它

        GlobalElectrical = 60              ///< 不限
    };

    /// \brief 流向类型
    enum class FlowDirectionType : Int32
    {
        Bidirectional = 0,                 ///< 双向
        In = 1,                            ///< 进
        Out = 2                            ///< 出
    };
    /// \brief 相序
    enum class Phase :Int32
    {
        Invalid = -1, /// 非法数据
        L1L2L3 = 0,
        Single = 1,
        L1 = 2,
        L2 = 3,
        L3 = 4
    };

    /// \brief 管道配置类型
    enum class RoutingPreferenceRuleGroupType : Int32
    {
        Undefined = -1,      ///< 未定义

        Segments = 0,       ///< 管段
        Elbows = 1,         ///< 弯头类型
        Junctions = 2,      ///< 三通类型
        Crosses = 3,        ///< 四通类型
        Transitions = 4,    ///< 变径类型
        Unions = 5,          ///<活接头
        Caps = 6,           ///< 端部堵头类型
        MechanicalJoints = 7, ///< The mechanical joint types that connect fitting to fitting, segment to fitting, or segment to segment
        
        TransitionsRectangularToRound = 11, ///<矩形到圆形
        TransitionsRectangularToOval = 12,    ///<矩形到椭圆形
        TransitionsOvalToRound = 13,            ///<椭圆形到圆形

        VerticalInsideElbows = 21,  ///< 垂直内弯头类型(电缆桥架使用)
        VerticalOutsideElbows = 22,  ///< 垂直外弯头类型(电缆桥架使用)
        VerticalLateralJunctions = 23, ///< 垂直侧向三通类型(电缆桥架使用)
        VerticalLateralElbows = 24, ///< 垂直侧向弯头类型(电缆桥架使用)
        VerticalLeftLateralElbows = 26, ///< 垂直侧向左接弯头类型(电缆桥架使用)
        VerticalRightLateralElbows = 27, ///< 垂直侧向右接弯头类型(电缆桥架使用)
        VerticalDownwardJunctions = 28, ///< 垂直向下三通(电缆桥架使用)
        VerticalUpwardJunctions = 29, ///< 垂直向上三通(电缆桥架使用)
        VerticalDownRightElbow = 30, ///< 垂直向下右接弯头类型(电缆桥架使用)
        VerticalDownLeftElbow = 31 ///< 垂直向下左接弯头类型(电缆桥架使用)
    };

    /// \brief 对象样式或视图对象样式中模型对象的对象样式显示规则
    SERIALIZABLE_ENUM_CLASS(GraphicsStyleDisplayRule)
    {
        Category = 0,                         ///< 按模型
        SystemType = 1,                        ///< 按系统类型
        CableTrayUsage = 2                   ///< 桥架用途
    };

    /// \brief 视图对象样式中的详细程度
    SERIALIZABLE_ENUM_CLASS(GraphicsStyleDetailLevel)
    {
        ByView = -1,    ///< 按视图
        Coarse = 0,     ///< 粗略
        Medium = 1,     ///< 中等
        Fine = 2        ///< 精细
    };

    /// \brief 专业名称
    class GMEP_COMMONDATA_EXPORT MEPDisciplineDefinition
    {
    public:
        static const std::map<gmep::MEPDisciplineId, std::wstring>& GetDisciplineNameList();

    };

    /// \brief 系统分类名称
    class GMEP_COMMONDATA_EXPORT MEPSystemClassificationDefinition
    {
    public:
        static const std::map<gmep::MEPSystemClassification, std::wstring>& GetSystemClassificationNameList();
        // 获取某系统分类名称
        static const std::wstring& GetSystemClassificationName(gmep::MEPSystemClassification mepSystemClassification);
        // 获取某系统分类的枚举
        static gmep::MEPSystemClassification GetSystemClassification(const std::wstring  &mepSystemClassificationName);

        // 获取专业下的可用的系统分类列表
        static const std::map<gmep::MEPSystemClassification, std::wstring>& GetAvailableSystemClassificationList(gmep::MEPDisciplineId discipId);
        // 获取系统分类类型下的可用的系统分类列表
        static const std::set<MEPSystemClassification>& GetAvailableSystemClassificationListBySystemClassificationType(MEPSystemClassificationType type);
    };

    /// \brief 连接方式类型名称
    class GMEP_COMMONDATA_EXPORT MEPConnectorTypeDefinition
    {
    public:
        static const std::map<gmep::MEPConnectorType, std::wstring>  ConnectorTypeNameList;
    };

    /// \brief 管件零件类型类型名称
    class GMEP_COMMONDATA_EXPORT MEPFittingPartTypeDefinition
    {
    public:
        static const std::map<gmep::FittingPartType, std::wstring>& GetAvailableFittingPartTypeList(gmep::GmepProjectSettingMEPObjectType curveType);
    };

    /// \brief 布管配置名称
    class GMEP_COMMONDATA_EXPORT MEPRoutingPreferenceRuleGroupTypeDefinition
    {
    public:
        static const std::map<gmep::RoutingPreferenceRuleGroupType, std::wstring>& GetAvailableRoutingGroupTypeNameList(gmep::GmepProjectSettingMEPObjectType curveType);
        static const std::wstring& GetRoutingGroupTypeName(gmep::RoutingPreferenceRuleGroupType routingGroupType);
    };
    // 二维图例类型
    enum class GmepLegendType : int32_t // 与gcs::ILegend::LegendType 对应
    {
        Invalid = 0,
        Plan = 1,// 平面
        Elevation = 2, // 前后立面
        Profile = 3, // 左右立面
        Electric = 4 //电气专业图例
    };

    //空间类型
    enum class  SpaceTypeEnum : int32_t
    {
        Undefined = -1,                                                      ///< 未定义
        Normal = 0,                                                          ///普通空间
        SmokeZone = 1                                                        ///防烟分区
    };

    //防排烟系统分类
    enum class SmokeControlSystemTypeEnum : int32_t
    {
        Undefined = -1,
        MechanicalSmokePreventionSystem = 0, //机械防烟系统
        MechanicalSmokeExtractionSystem = 1, //机械排烟系统
        NaturalSmokeExtractionSystem = 2,    //自然排烟系统
    };

    /// \brief 子节点类型
    enum class ChildNodeType : Int32
    {
        Undefined = -1,
        MiddleLine = 0,       //中心线          L"中心线"
        PipeRiserSymbol,     //给排水立管符号  L"水管立管符号HVAC"
        HVACRiserSymbol,     //暖通立管符号    L"水管立管符号PIPE"
        DuctRiserUpSymbol,   //风管上翻符号    L"风管立管上翻符号"
        DuctRiserDownSymbol, //风管下翻符号    L"风管立管下翻符号"
        UpAndDownWireSymbol, //引上引下线      L"引上引下"
    };

    /// \brief 子节点名称
    class GMEP_COMMONDATA_EXPORT ChildNodeGStyleName
    {
    public:
        static const std::wstring& GetChildNodeGStyleName(gmep::ChildNodeType childNodeType);
    };
}